//
//  AIHomeUpBottomBtn.m
//  Mia
//
//  Created by Vill on 2024/1/10.
//

#import "AIHomeUpBottomBtn.h"

@interface AIHomeUpBottomBtn ()
@property (nonatomic, strong) UIImageView *iconImg;  //图标
@property (nonatomic, strong) UILabel *bottomLbl;
@end

@implementation AIHomeUpBottomBtn

- (instancetype)initWithFrame:(CGRect)frame{
    if (self == [super initWithFrame:frame]){
        
        [self addSubview:self.bottomLbl];
        [self.bottomLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.centerX.mas_equalTo(self);
        }];
        
        [self addSubview:self.iconImg];
        [self.iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.mas_equalTo(self.bottomLbl.mas_top);
            make.top.mas_equalTo(self);
            make.centerX.mas_equalTo(self);
        }];
    }
    return self;
}

- (UIImageView *)iconImg{
    if(!_iconImg){
        _iconImg = [UIImageView new];
    }
    return _iconImg;
}

- (UILabel *)bottomLbl{
    if(!_bottomLbl){
        _bottomLbl = [UILabel new];
        _bottomLbl.textColor = UIColor.whiteColor;
        _bottomLbl.font = [UIFont fontWithWeight:MTBold size:PTW(11)];
        _bottomLbl.textAlignment = NSTextAlignmentCenter;
    }
    return _bottomLbl;
}

- (void)setTitle:(NSString *)str withImg:(NSString *)img{
    self.bottomLbl.text = str;
    self.iconImg.image = KImaged(img);
}


@end
